package inter;

import lexer.Token;
import symbols.Type;

public class Arith extends Op {
	public Expr expr1, expr2;
	
	public Arith(Token tok, Expr x1, Expr x2) {
		super(tok, null);
		expr1 = x1;
		expr2 = x2;
		if( expr1.type != Type.INT || expr2.type != Type.INT){
			error("Tipo de operador incompativel");
		}
		type = Type.INT;
	}
	
	public Expr gen(){
		return new Arith(op, expr1.reduce(), expr2.reduce());
	}
	
	public String toString(){
		return " " + expr1.toString() + " " + op.toString() + " " + expr2.toString() ;
	}
}